package br.org.etec.dotcao.model;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Table(name="tevent")
@Entity
public class Event extends AbstractEntity{

	private static final long serialVersionUID = 1L;

	@Column
	private String name;

	@Temporal(TemporalType.TIMESTAMP)
	private Date date;

	@Column
	private String description;

	@OneToOne(cascade={CascadeType.PERSIST, CascadeType.MERGE})
	@JoinColumn(name="location")
	private Location location;

	@OneToMany(cascade=CascadeType.ALL, mappedBy="event")	
	private List<EventComment> comments;
	
	@OneToMany(cascade=CascadeType.ALL, mappedBy="event")
	private List<EventPicture> pictures;
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Location getLocation() {
		return location;
	}

	public void setLocation(Location location) {
		this.location = location;
	}

	public List<EventComment> getComments() {
		return comments;
	}

	public void setComments(List<EventComment> comments) {
		this.comments = comments;
	}
	
	public List<EventPicture> getPictures() {
		return pictures;
	}
	
	public void setPictures(List<EventPicture> pictures) {
		this.pictures = pictures;
	}
}
